<template>
    <div class="signeList">
        <Row>
            <Col :xs="24">
                <div class="margin-up-down">
                    <Select class="w-select" v-model="statisticalYear" placeholder="请选择年份">
                        <Option
                            v-for="item in yearlist"
                            :value="item.value"
                            :key="item.value"
                            style='text-align:center'
                        >{{item.name}}</Option>
                    </Select>
                </div>
                <div class="margin-up-down">
                    <Select class="w-select" clearable v-model="statisticalMonth" placeholder="请选择月份"  >
                        <Option
                            v-for="item in monthList"
                            :value="item.id"
                            :key="item.id"
                            style='text-align:center'
                        >{{item.name}}</Option>
                    </Select>
                </div>
                <div class="margin-up-down">
                    <Button type="primary" @click="loadPage(1)" class="btn">
                        <Icon type="ios-search" size="14"/>
                    </Button>
                </div>
                <div class="margin-up-down">
                    <Button icon="icon-gengxin" @click="reset" class="btn">
                        <i class = "iconfont icon-gengxin" style="font-size:16px;margin-left:-8px;"></i>
                    </Button>
                </div>
                <div class="margin-up-down">
                    <Button @click='fileDownload' icon="ios-download-outline" type="primary" style="background-color: #5362e1; border: none;">导出报表</Button>
                </div>
            </Col>
        </Row>
        <Row class="little-btns">
            <Col :span="24">
                <div style="border-bottom: 1px solid #e9e9e9;padding-bottom:6px;margin-bottom:6px;">
                    人员分类 &nbsp; : &nbsp;
                    <Checkbox
                        :indeterminate="indeterminate"
                        :value="checkAll"
                        @click.prevent.native="handleCheckAll">全选</Checkbox>
                </div>
                <CheckboxGroup v-model="checkAllGroup" @on-change="checkAllGroupChange($event)">
                    <Checkbox label="健康人"></Checkbox>
                    <Checkbox label="高血压"></Checkbox>
                    <Checkbox label="糖尿病"></Checkbox>
                    <Checkbox label="65岁以上老年人"></Checkbox>
                    <Checkbox label="孕产妇"></Checkbox>
                    <Checkbox label="0-6岁儿童"></Checkbox>
                    <Checkbox label="肺结核"></Checkbox>
                    <Checkbox label="严重精神障碍患者"></Checkbox>
                    <Checkbox label="残疾人"></Checkbox>
                    <Checkbox label="低保、五保户"></Checkbox>
                    <Checkbox label="计生特殊困难家庭"></Checkbox>
                    <Checkbox label="脱贫户"></Checkbox>
                    <Checkbox label="边缘易致贫户"></Checkbox>
                    <Checkbox label="突发严重困难户"></Checkbox>
                    <Checkbox label="其他人群"></Checkbox>
                    <!-- <Checkbox v-for="item in checkAllGroup" :key="item.value" :label='item'></Checkbox> -->
                </CheckboxGroup>
            </Col>
        </Row>
        <h3 style="text-align: center; margin: 15px 0; font-weight:600">家庭医生签约服务进展情况报表</h3>
        <Table class="m-table" stripe :columns="columns" :data="dataList"></Table>
        <!-- <table class="m-table table-hover" style="overflow: scroll;">
            <tr class="title">
                <th style="">排序</th>
                <th v-for="(item,index) in columnName">{{item.name}}</th>
            </tr>
            <tr class="title hang" v-for="(p,index) in dataList">
                <td>{{index+1}}</td>
                <td v-for="value in p.columnValue">{{value}}</td>
            </tr>
            <tr class="title hang">
                <td></td>
                <td>合计：</td>
                <td v-for="value in zj">{{value}}</td>
            </tr>
        </table> -->
    </div>
</template>
<script>
import api from "@/api/commonApi";
import Utils from "@/utils";

export default { 
    data() {
        return {
            yearlist: [],
            monthList: [
                { id: '01', name: "1月" },
                { id: '02', name: "2月" },
                { id: '03', name: "3月" },
                { id: '04', name: "4月" },
                { id: '05', name: "5月" },
                { id: '06', name: "6月" },
                { id: '07', name: "7月" },
                { id: '08', name: "8月" },
                { id: '09', name: "9月" },
                { id: '10', name: "10月" },
                { id: '11', name: "11月" },
                { id: '12', name: "12月" },
            ],
            columnName: [
                // { id: 0, name: "排序" },
                { id: 1, name: "签约机构名称" },
                { id: 2, name: "家庭医生人数（人）" },
                { id: 3, name: "家庭医生团队中全科医生人数（人）" },
                { id: 4, name: "家庭医生团队中专科医生人数（人）" },
                { id: 5, name: "已组建家庭医生团队数（个）" },
                { id: 6, name: "辖区内常住居民数（人）" },
                { id: 7, name: "常住人口签约数（人）" },
                { id: 8, name: "常住人口签约续约数（人）" },
                { id: 9, name: "常住人口签约率" },
                { id: 10, name: "辖区内0-6岁儿童数（人）" },
                { id: 11, name: "0-6岁儿童签约数（人）" },
                { id: 12, name: "0-6岁儿童签约续约数（人）" },
                { id: 13, name: "辖区内65岁及以上常住居民数（人）" },
                { id: 14, name: "65岁及以上常住居民签约数（人）" },
                { id: 15, name: "65岁及以上常住居民签约续约数（人）" },
                { id: 16, name: "3周之前建册并进行第一次产前检查的产妇人数（人）" },
                { id: 17, name: "孕产妇签约数（人）" },
                { id: 18, name: "年内辖区内已管理的高血压患者人数（人）" },
                { id: 19, name: "在管高血压患者家庭医生签约人数（人）" },
                { id: 20, name: "年内辖区内已管理的2型糖尿病患者人数（人）" },
                { id: 21, name: "糖尿病患者签约数（人）" },
                { id: 22, name: "糖尿病患者签约续约数（人）" },
                { id: 23, name: "已管理的肺结核患者人数（人）" },
                { id: 24, name: "肺结核患者签约数（人）" },
                { id: 25, name: "注册、诊断明确、在家居住的严重精神障碍患者人数（人）" },
                { id: 26, name: "严重精神障碍患者签约数（人）" },
                { id: 27, name: "严重精神障碍患者签约续约数（人）" },
                { id: 28, name: "辖区内残疾人数（人）" },
                { id: 29, name: "残疾签约数（人）" },
                { id: 30, name: "残疾签约续约数（人）" },
                { id: 31, name: "纳入计划生育家庭特别扶助制度的独生子女伤残或死亡家庭的夫妻人数（人）" },
                { id: 32, name: "纳入计划生育家庭特别扶助制度的独生子女伤残或死亡家庭的夫妻签约数（人）" },
                { id: 33, name: "纳入计划生育家庭特别扶助制度的独生子女伤残或死亡家庭的夫妻签约续约数（人）" },
                { id: 34, name: "辖区内脱贫人口数（人）" },
                { id: 35, name: "脱贫人口签约数（人）" },
                { id: 36, name: "脱贫人口签约续约数（人）" },
                { id: 37, name: "辖区内易返贫人口数（人）" },
                { id: 38, name: "辖区内易返贫人口签约数（人）" },
                { id: 39, name: "重点人群人口数（人）" },
                { id: 40, name: "重点人群签约人口数（人）" },
                { id: 41, name: "重点人群签约率" },
                { id: 42, name: "健康人群人口数（人）" },
                { id: 43, name: "健康人群签约人口数（人）" },
                { id: 44, name: "健康人群签约率" },
                { id: 45, name: "低保人群人口数（人）" },
                { id: 46, name: "低保人群签约人口数（人）" },
                { id: 47, name: "低保人群签约率" },
                { id: 48, name: "突发困难人群人口数（人）" },
                { id: 49, name: "突发困难人群签约人口数（人）" },
                { id: 50, name: "突发困难人群签约率" },
                { id: 51, name: "其他人群人口数（人）" },
                { id: 52, name: "其他人群签约人口数（人）" },
                { id: 53, name: "其他人群签约率" },
            ],
            //即使 columnsALL 与 columns 中内容一样，也必须俩个都有，不可删除任意一个
            columnsALL: [
                {
                    title: "排序",
                    key: "sum",
                    width: 80,
                    align: "center",
                    render: (h, params) => {
                        let sum = params.row._index + 1;
                        return h("span", sum);
                    },
                },
                { title: "签约机构名称", key: "orgName", align: "center", width: 150, },
                { title: "家庭医生人数（人）", key: "doctorNum", align: "center", width: 150, },
                { title: "家庭医生团队中全科医生人数（人）", key: "generalNum", align: "center", width: 200, },
                { title: "家庭医生团队中专科医生人数（人）", key: "practitionerNum", align: "center", width: 200, },
                { title: "已组建家庭医生团队数（个）", key: "teamNum", align: "center", width: 150, },
                { title: "辖区内常住居民数（人）", key: "permanentResidentNum", align: "center", width: 150, },
                { title: "常住人口签约数（人）", key: "permanentResidentContractNum", align: "center", width: 150, },
                { title: "常住人口签约续约数（人）", key: "permanentResidentExtendNum", align: "center", width: 150, },
                { title: "常住人口签约率（%）", key: "permanentResidentContractRate", align: "center", width: 150, },
                { title: "辖区内0-6岁儿童数（人）", key: "childrenNum", align: "center", width: 150, },
                { title: "0-6岁儿童签约数（人）", key: "childrenContractNum", align: "center", width: 150, 
                    render: (h, params) => {
                        let childrenContractNum
                        if(params.row.childrenContractNum) {
                            childrenContractNum = params.row.childrenContractNum
                        } else {
                            childrenContractNum = 0
                        }
                        return h("span", childrenContractNum);
                    },
                },
                { title: "0-6岁儿童签约续约数（人）", key: "childrenExtendNum", align: "center", width: 150, },
                { title: "辖区内65岁及以上常住居民数（人）", key: "elderlyNum", align: "center", width: 150, },
                { title: "65岁及以上常住居民签约数（人）", key: "elderlyContractNum", align: "center", width: 200, },
                { title: "65岁及以上常住居民签约续约数（人）", key: "elderlyExtendNum", align: "center", width: 200, },
                { title: "13周之前建册并进行第一次产前检查的产妇人数（人）", key: "puerperaNum", align: "center", width: 200, },
                { title: "孕产妇签约数（人）", key: "puerperaContractNum", align: "center", width: 150, },
                { title: "年内辖区内已管理的高血压患者人数（人）", key: "hypertensivePatientsNum", align: "center", width: 200, },
                { title: "在管高血压患者家庭医生签约人数（人）", key: "hypertensivePatientsContractNum", align: "center", width: 150, },
                { title: "年内辖区内已管理的2型糖尿病患者人数（人）", key: "diabeticNum", align: "center", width: 150, },
                { title: "糖尿病患者签约数（人）", key: "diabeticContractNum", align: "center", width: 150, },
                { title: "糖尿病患者签约续约数（人）", key: "diabeticExtendNum", align: "center", width: 150, },
                { title: "已管理的肺结核患者人数（人）", key: "tuberculosisPatientsNum", align: "center", width: 200, },
                { title: "肺结核患者签约数（人）", key: "tuberculosisPatientsContractNum", align: "center", width: 150, },
                { title: "注册、诊断明确、在家居住的严重精神障碍患者人数（人）", key: "mentalDisorderNum", align: "center", width: 200, },
                { title: "严重精神障碍患者签约数（人）", key: "mentalDisorderContractNum", align: "center", width: 200, },
                { title: "严重精神障碍患者签约续约数（人）", key: "mentalDisorderExtendNum", align: "center", width: 200, },
                { title: "辖区内残疾人数（人）", key: "disabledNum", align: "center", width: 150, },
                { title: "残疾签约数（人）", key: "disabledContractNum", align: "center", width: 150, },
                { title: "残疾签约续约数（人）", key: "disabledExtendNum", align: "center", width: 150, },
                { title: "纳入计划生育家庭特别扶助制度的独生子女伤残或死亡家庭的夫妻人数（人）", key: "spouseNum", align: "center", width: 250, },
                { title: "纳入计划生育家庭特别扶助制度的独生子女伤残或死亡家庭的夫妻签约数（人）", key: "spouseContractNum", align: "center", width: 250, },
                { title: "纳入计划生育家庭特别扶助制度的独生子女伤残或死亡家庭的夫妻签约续约数（人）", key: "spouseExtendNum", align: "center", width: 250, },
                { title: "辖区内脱贫人口数（人）", key: "noPoorNum", align: "center", width: 150, },
                { title: "脱贫人口签约数（人）", key: "noPoorContractNum", align: "center", width: 150, },
                { title: "脱贫人口签约续约数（人）", key: "noPoorExtendNum", align: "center", width: 150, },
                { title: "辖区内易返贫人口数（人）", key: "returnPoorNum", align: "center", width: 150, },
                { title: "辖区内易返贫人口签约数（人）", key: "returnPoorContractNum", align: "center", width: 150, },
                { title: "重点人群人口数（人）", key: "keyPopulationNum", align: "center", width: 150, },
                { title: "重点人群签约人口数（人）", key: "keyPopulationContractNum", align: "center", width: 150, },
                { title: "重点人群签约率", key: "keyPopulationContractRate", align: "center", width: 150, },
                { title: "健康人群人口数（人）", key: "healthyPopulationNum", align: "center", width: 150, },
                { title: "健康人群签约人口数（人）", key: "healthyPopulationContractNum", align: "center", width: 150, },
                { title: "健康人群签约率（%）", key: "healthyPopulationContractRate", align: "center", width: 150, },
                { title: "低保人群人口数（人）", key: "subsistenceAllowanceNum", align: "center", width: 150, },
                { title: "低保人群签约人口数（人）", key: "subsistenceAllowanceContractNum", align: "center", width: 150, },
                { title: "低保人群签约率（%）", key: "subsistenceAllowanceContractRate", align: "center", width: 150, },
                { title: "突发困难人群人口数（人）", key: "difficultCrowdNum", align: "center", width: 150, },
                { title: "突发困难人群签约人口数（人）", key: "difficultCrowdContractNum", align: "center", width: 150, },
                { title: "突发困难人群签约率（%）", key: "difficultCrowdContractRate", align: "center", width: 150, },
                { title: "其他人群人口数（人）", key: "otherGroupsNum", align: "center", width: 150, },
                { title: "其他人群签约人口数（人）", key: "otherGroupsContractNum", align: "center", width: 150, },
                { title: "其他人群签约率（%）", key: "otherGroupsContractRate", align: "center", width: 150, },
            ],
            columns: [
                {
                    title: "排序",
                    key: "sum",
                    width: 80,
                    align: "center",
                    render: (h, params) => {
                        let sum = params.row._index + 1;
                        return h("span", sum);
                    },
                },
                { title: "签约机构名称", key: "orgName", align: "center", width: 150, },
                { title: "家庭医生人数（人）", key: "doctorNum", align: "center", width: 150, },
                { title: "家庭医生团队中全科医生人数（人）", key: "generalNum", align: "center", width: 200, },
                { title: "家庭医生团队中专科医生人数（人）", key: "practitionerNum", align: "center", width: 200, },
                { title: "已组建家庭医生团队数（个）", key: "teamNum", align: "center", width: 150, },
                { title: "辖区内常住居民数（人）", key: "permanentResidentNum", align: "center", width: 150, },
                { title: "常住人口签约数（人）", key: "permanentResidentContractNum", align: "center", width: 150, },
                { title: "常住人口签约续约数（人）", key: "permanentResidentExtendNum", align: "center", width: 150, },
                { title: "常住人口签约率（%）", key: "permanentResidentContractRate", align: "center", width: 150, },
                { title: "辖区内0-6岁儿童数（人）", key: "childrenNum", align: "center", width: 150, },
                { title: "0-6岁儿童签约数（人）", key: "childrenContractNum", align: "center", width: 150, 
                    render: (h, params) => {
                        let childrenContractNum
                        if(params.row.childrenContractNum) {
                            childrenContractNum = params.row.childrenContractNum
                        } else {
                            childrenContractNum = 0
                        }
                        return h("span", childrenContractNum);
                    },
                },
                { title: "0-6岁儿童签约续约数（人）", key: "childrenExtendNum", align: "center", width: 150, },
                { title: "辖区内65岁及以上常住居民数（人）", key: "elderlyNum", align: "center", width: 150, },
                { title: "65岁及以上常住居民签约数（人）", key: "elderlyContractNum", align: "center", width: 200, },
                { title: "65岁及以上常住居民签约续约数（人）", key: "elderlyExtendNum", align: "center", width: 200, },
                { title: "3周之前建册并进行第一次产前检查的产妇人数（人）", key: "puerperaNum", align: "center", width: 200, },
                { title: "孕产妇签约数（人）", key: "puerperaContractNum", align: "center", width: 150, },
                { title: "年内辖区内已管理的高血压患者人数（人）", key: "hypertensivePatientsNum", align: "center", width: 200, },
                { title: "在管高血压患者家庭医生签约人数（人）", key: "hypertensivePatientsContractNum", align: "center", width: 150, },
                { title: "年内辖区内已管理的2型糖尿病患者人数（人）", key: "diabeticNum", align: "center", width: 150, },
                { title: "糖尿病患者签约数（人）", key: "diabeticContractNum", align: "center", width: 150, },
                { title: "糖尿病患者签约续约数（人）", key: "diabeticExtendNum", align: "center", width: 150, },
                { title: "已管理的肺结核患者人数（人）", key: "tuberculosisPatientsNum", align: "center", width: 200, },
                { title: "肺结核患者签约数（人）", key: "tuberculosisPatientsContractNum", align: "center", width: 150, },
                { title: "注册、诊断明确、在家居住的严重精神障碍患者人数（人）", key: "mentalDisorderNum", align: "center", width: 200, },
                { title: "严重精神障碍患者签约数（人）", key: "mentalDisorderContractNum", align: "center", width: 200, },
                { title: "严重精神障碍患者签约续约数（人）", key: "mentalDisorderExtendNum", align: "center", width: 200, },
                { title: "辖区内残疾人数（人）", key: "disabledNum", align: "center", width: 150, },
                { title: "残疾签约数（人）", key: "disabledContractNum", align: "center", width: 150, },
                { title: "残疾签约续约数（人）", key: "disabledExtendNum", align: "center", width: 150, },
                { title: "纳入计划生育家庭特别扶助制度的独生子女伤残或死亡家庭的夫妻人数（人）", key: "spouseNum", align: "center", width: 250, },
                { title: "纳入计划生育家庭特别扶助制度的独生子女伤残或死亡家庭的夫妻签约数（人）", key: "spouseContractNum", align: "center", width: 250, },
                { title: "纳入计划生育家庭特别扶助制度的独生子女伤残或死亡家庭的夫妻签约续约数（人）", key: "spouseExtendNum", align: "center", width: 250, },
                { title: "辖区内脱贫人口数（人）", key: "noPoorNum", align: "center", width: 150, },
                { title: "脱贫人口签约数（人）", key: "noPoorContractNum", align: "center", width: 150, },
                { title: "脱贫人口签约续约数（人）", key: "noPoorExtendNum", align: "center", width: 150, },
                { title: "辖区内易返贫人口数（人）", key: "returnPoorNum", align: "center", width: 150, },
                { title: "辖区内易返贫人口签约数（人）", key: "returnPoorContractNum", align: "center", width: 150, },
                { title: "重点人群人口数（人）", key: "keyPopulationNum", align: "center", width: 150, },
                { title: "重点人群签约人口数（人）", key: "keyPopulationContractNum", align: "center", width: 150, },
                { title: "重点人群签约率（%）", key: "keyPopulationContractRate", align: "center", width: 150, },
                { title: "健康人群人口数（人）", key: "healthyPopulationNum", align: "center", width: 150, },
                { title: "健康人群签约人口数（人）", key: "healthyPopulationContractNum", align: "center", width: 150, },
                { title: "健康人群签约率（%）", key: "healthyPopulationContractRate", align: "center", width: 150, },
                { title: "低保人群人口数（人）", key: "subsistenceAllowanceNum", align: "center", width: 150, },
                { title: "低保人群签约人口数（人）", key: "subsistenceAllowanceContractNum", align: "center", width: 150, },
                { title: "低保人群签约率（%）", key: "subsistenceAllowanceContractRate", align: "center", width: 150, },
                { title: "突发困难人群人口数（人）", key: "difficultCrowdNum", align: "center", width: 150, },
                { title: "突发困难人群签约人口数（人）", key: "difficultCrowdContractNum", align: "center", width: 150, },
                { title: "突发困难人群签约率（%）", key: "difficultCrowdContractRate", align: "center", width: 150, },
                { title: "其他人群人口数（人）", key: "otherGroupsNum", align: "center", width: 150, },
                { title: "其他人群签约人口数（人）", key: "otherGroupsContractNum", align: "center", width: 150, },
                { title: "其他人群签约率（%）", key: "otherGroupsContractRate", align: "center", width: 150, },
            ],
            dataList: [],
            statisticalYear: '',
            statisticalMonth: '',
            indeterminate: true,
            checkAll: false,
             //人群分类
            checkAllGroup: [
                '健康人', '高血压', '糖尿病', '65岁以上老年人', '孕产妇', '0-6岁儿童', '肺结核', '严重精神障碍患者', '残疾人', '低保、五保户', '计生特殊困难家庭', '脱贫户', '边缘易致贫户', '突发严重困难户', '其他人群', 
            ],
        };
    },
    created() {
        let breadList = [
            { path: "/index", title: "首页" },
            {
                path: "/index/operation/ordersmanagement/index",
                title: "订单管理"
            },
            {
                path: "/index/comprehensive/registration/list",
                title: "预约挂号订单"
            }
        ];
        this.$emit("changeBreadList", breadList);
    },
    mounted() {
        this.yearChange();
        //上来就加载第一页数据
        this.loadPage(1); 
    },
    methods: {
       handleCheckAll () {
            if (this.indeterminate) {
                this.checkAll = false;
            } else {
                this.checkAll = !this.checkAll;
            }
            this.indeterminate = false;
            if (this.checkAll) {
                this.checkAllGroup = [
                '健康人', '高血压', '糖尿病', '65岁以上老年人', '孕产妇', '0-6岁儿童', '肺结核', '严重精神障碍患者', '残疾人', '低保、五保户', '计生特殊困难家庭', '脱贫户', '边缘易致贫户', '突发严重困难户', '其他人群', ]
                this.columns = this.columnsALL
            } else {
                this.checkAllGroup = [];
                this.columns = this.columns.filter(
                        col => col.key !== 'healthyPopulationNum' &&  col.key !== 'healthyPopulationContractNum' &&  col.key !== 'healthyPopulationContractRate' && col.key !== 'hypertensivePatientsNum' &&  col.key !== 'hypertensivePatientsContractNum' && col.key !== 'diabeticNum' &&  col.key !== 'diabeticContractNum' &&  col.key !== 'diabeticExtendNum' && col.key !== 'elderlyNum' &&  col.key !== 'elderlyContractNum' &&  col.key !== 'elderlyExtendNum' && col.key !== 'puerperaNum' &&  col.key !== 'puerperaContractNum' && col.key !== 'childrenNum' &&  col.key !== 'childrenContractNum' &&  col.key !== 'childrenExtendNum' && col.key !== 'tuberculosisPatientsNum' &&  col.key !== 'tuberculosisPatientsContractNum' && col.key !== 'mentalDisorderNum' &&  col.key !== 'mentalDisorderContractNum' &&  col.key !== 'mentalDisorderExtendNum' && col.key !== 'disabledNum' &&  col.key !== 'disabledContractNum' &&  col.key !== 'disabledExtendNum' && col.key !== 'subsistenceAllowanceNum' &&  col.key !== 'subsistenceAllowanceContractNum' &&  col.key !== 'subsistenceAllowanceContractRate' && col.key !== 'spouseNum' &&  col.key !== 'spouseContractNum' &&  col.key !== 'spouseExtendNum' && col.key !== 'noPoorNum' &&  col.key !== 'noPoorContractNum' &&  col.key !== 'noPoorExtendNum' && col.key !== 'returnPoorNum' &&  col.key !== 'returnPoorContractNum' && col.key !== 'difficultCrowdNum' &&  col.key !== 'difficultCrowdContractNum' &&  col.key !== 'difficultCrowdContractRate' && col.key !== 'otherGroupsNum' &&  col.key !== 'otherGroupsContractNum' &&  col.key !== 'otherGroupsContractRate')
            }
        },
        checkAllGroupChange (data) {
            if (data.length === 15) {
                this.indeterminate = false;
                this.checkAll = true;
            } else if (data.length > 0) {
                this.indeterminate = true;
                this.checkAll = false;
            } else {
                this.indeterminate = false;
                this.checkAll = false;
            }
            let aa = []
            let group = [
                '健康人', '高血压', '糖尿病', '65岁以上老年人', '孕产妇', '0-6岁儿童', '肺结核', '严重精神障碍患者', '残疾人', '低保、五保户', '计生特殊困难家庭', '脱贫户', '边缘易致贫户', '突发严重困难户', '其他人群', ]
            aa = group.filter(i => data.indexOf(i) === -1)     //获取未选中的项
            this.columns = this.columnsALL       //用来切换同一勾选项状态时实现列表数据的恢复
            aa.forEach(qq =>{
                if(qq=='健康人') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'healthyPopulationNum' &&  col.key !== 'healthyPopulationContractNum' &&  col.key !== 'healthyPopulationContractRate')
                } else {

                }
                if(qq=='高血压') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'hypertensivePatientsNum' &&  col.key !== 'hypertensivePatientsContractNum')
                }
                if(qq=='糖尿病') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'diabeticNum' &&  col.key !== 'diabeticContractNum' &&  col.key !== 'diabeticExtendNum')
                }
                if(qq=='65岁以上老年人') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'elderlyNum' &&  col.key !== 'elderlyContractNum' &&  col.key !== 'elderlyExtendNum')
                }
                if(qq=='孕产妇') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'puerperaNum' &&  col.key !== 'puerperaContractNum')
                }
                if(qq=='0-6岁儿童') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'childrenNum' &&  col.key !== 'childrenContractNum' &&  col.key !== 'childrenExtendNum')
                }
                if(qq=='肺结核') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'tuberculosisPatientsNum' &&  col.key !== 'tuberculosisPatientsContractNum')
                }
                if(qq=='严重精神障碍患者') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'mentalDisorderNum' &&  col.key !== 'mentalDisorderContractNum' &&  col.key !== 'mentalDisorderExtendNum')
                }
                if(qq=='残疾人') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'disabledNum' &&  col.key !== 'disabledContractNum' &&  col.key !== 'disabledExtendNum')
                }
                if(qq=='低保、五保户') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'subsistenceAllowanceNum' &&  col.key !== 'subsistenceAllowanceContractNum' &&  col.key !== 'subsistenceAllowanceContractRate')
                }
                if(qq=='计生特殊困难家庭') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'spouseNum' &&  col.key !== 'spouseContractNum' &&  col.key !== 'spouseExtendNum')
                }
                if(qq=='脱贫户') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'noPoorNum' &&  col.key !== 'noPoorContractNum' &&  col.key !== 'noPoorExtendNum')
                }
                if(qq=='边缘易致贫户') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'returnPoorNum' &&  col.key !== 'returnPoorContractNum')
                }
                if(qq=='突发严重困难户') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'difficultCrowdNum' &&  col.key !== 'difficultCrowdContractNum' &&  col.key !== 'difficultCrowdContractRate')
                }
                if(qq=='其他人群') {
                    this.columns = this.columns.filter(
                        col => col.key !== 'otherGroupsNum' &&  col.key !== 'otherGroupsContractNum' &&  col.key !== 'otherGroupsContractRate')
                }
                
            })     
            // console.log('筛选过的列表',this.columns)
        },
        //获取年份下拉数组
        yearChange () {
            var myDate = new Date()
            var startYear = myDate.getFullYear() - 5    // 起始年份
            var endYear = myDate.getFullYear()    // 结束年份
            this.statisticalYear = endYear    // 当前年份
            this.yearlist = []
            for (var i = startYear; i <= endYear; i++) {
                this.yearlist.unshift({value: (i), name: (i)+'年'})
            }
        },
        //加载列表数据
        loadPage(pageNo) {
            let params = {
                statisticalYear: this.statisticalYear,
                statisticalMonth: this.statisticalMonth ? this.statisticalMonth : 12,
            }        
            this.$axios.post(api.getFdsSeviceProgressReports, params).then(resp => {
                if (resp.data.success) {
                    this.dataList = resp.data.object;
                    // if(this.dataList.length) {
                    //     let doctorNumTotal = 0, generalNumTotal = 0, practitionerNumTotal = 0, teamNumTotal = 0, permanentResidentNumTotal = 0, permanentResidentContractNumTotal = 0, permanentResidentExtendNumTotal = 0, permanentResidentContractRateTotal = 0, childrenNumTotal = 0, childrenContractNummTotal = 0, childrenExtendNumTotal = 0, elderlyNumTotal = 0, elderlyContractNumTotal = 0, elderlyExtendNumTotal = 0, puerperaNumTotal = 0, puerperaContractNumTotal = 0, hypertensivePatientsNumTotal = 0, hypertensivePatientsContractNumTotal = 0, diabeticNumTotal = 0, diabeticContractNumTotal = 0, diabeticExtendNumTotal = 0, tuberculosisPatientsNumTotal = 0, tuberculosisPatientsContractNumTotal = 0, mentalDisorderNumTotal = 0, mentalDisorderContractNumTotal = 0, mentalDisorderExtendNumTotal = 0, disabledNumTotal = 0, disabledContractNumTotal = 0, disabledExtendNumTotal = 0, spouseNumTotal = 0, spouseContractNumTotal = 0, spouseExtendNumTotal = 0, noPoorNumTotal = 0, noPoorContractNumTotal = 0, noPoorExtendNumTotal = 0, returnPoorNumTotal = 0, returnPoorContractNumTotal = 0, keyPopulationNumTotal = 0, keyPopulationContractNumTotal = 0, keyPopulationContractRateTotal = 0, healthyPopulationNumTotal = 0, healthyPopulationContractNumTotal = 0, healthyPopulationContractRateTotal = 0, subsistenceAllowanceNumTotal = 0, subsistenceAllowanceContractNumTotal = 0, subsistenceAllowanceContractRateTotal = 0, difficultCrowdNumTotal = 0, difficultCrowdContractNumTotal = 0, difficultCrowdContractRateTotal = 0, otherGroupsNumTotal = 0, otherGroupsContractNumTotal = 0, otherGroupsContractRateTotal = 0
                        // this.dataList.forEach((item, index) => {
                        //     item.doctorNum && (doctorNumTotal += item.doctorNum);
                        //     item.generalNum && (generalNumTotal += item.generalNum);
                        //     item.practitionerNum && (practitionerNumTotal += item.practitionerNum);
                        //     item.teamNum && (teamNumTotal += item.teamNum);
                        //     item.permanentResidentNum && (permanentResidentNumTotal += item.permanentResidentNum);
                        //     item.permanentResidentContractNum && (permanentResidentContractNumTotal += item.permanentResidentContractNum);
                        //     item.permanentResidentExtendNum && (permanentResidentExtendNumTotal += item.permanentResidentExtendNum);
                        //     item.permanentResidentContractRate && (permanentResidentContractRateTotal += item.permanentResidentContractRate);
                        //     item.childrenNum && (childrenNumTotal += item.childrenNum);
                        //     item.childrenContractNum && (childrenContractNummTotal += item.childrenContractNum);
                        //     item.childrenExtendNum && (childrenExtendNumTotal += item.childrenExtendNum);
                        //     item.elderlyNum && (elderlyNumTotal += item.elderlyNum);
                        //     item.elderlyContractNum && (elderlyContractNumTotal += item.elderlyContractNum);
                        //     item.elderlyExtendNum && (elderlyExtendNumTotal += item.elderlyExtendNum);
                        //     item.puerperaNum && (puerperaNumTotal += item.puerperaNum);
                        //     item.puerperaContractNum && (puerperaContractNumTotal += item.puerperaContractNum);
                        //     item.hypertensivePatientsNum && (hypertensivePatientsNumTotal += item.hypertensivePatientsNum);
                        //     item.hypertensivePatientsContractNum && (hypertensivePatientsContractNumTotal += item.hypertensivePatientsContractNum);
                        //     item.diabeticNum && (diabeticNumTotal += item.diabeticNum);
                        //     item.diabeticContractNum && (diabeticContractNumTotal += item.diabeticContractNum);
                        //     item.diabeticExtendNum && (diabeticExtendNumTotal += item.diabeticExtendNum);
                        //     item.tuberculosisPatientsNum && (tuberculosisPatientsNumTotal += item.tuberculosisPatientsNum);
                        //     item.tuberculosisPatientsContractNum && (tuberculosisPatientsContractNumTotal += item.tuberculosisPatientsContractNum);
                        //     item.mentalDisorderNum && (mentalDisorderNumTotal += item.mentalDisorderNum);
                        //     item.mentalDisorderContractNum && (mentalDisorderContractNumTotal += item.mentalDisorderContractNum);
                        //     item.mentalDisorderExtendNum && (mentalDisorderExtendNumTotal += item.mentalDisorderExtendNum);
                        //     item.disabledNum && (disabledNumTotal += item.disabledNum);
                        //     item.disabledContractNum && (disabledContractNumTotal += item.disabledContractNum);
                        //     item.disabledExtendNum && (disabledExtendNumTotal += item.disabledExtendNum);
                        //     item.spouseNum && (spouseNumTotal += item.spouseNum);
                        //     item.spouseContractNum && (spouseContractNumTotal += item.spouseContractNum);
                        //     item.spouseExtendNum && (spouseExtendNumTotal += item.spouseExtendNum);
                        //     item.noPoorNum && (noPoorNumTotal += item.noPoorNum);
                        //     item.noPoorContractNum && (noPoorContractNumTotal += item.noPoorContractNum);
                        //     item.noPoorExtendNum && (noPoorExtendNumTotal += item.noPoorExtendNum);
                        //     item.returnPoorNum && (returnPoorNumTotal += item.returnPoorNum);
                        //     item.returnPoorContractNum && (returnPoorContractNumTotal += item.returnPoorContractNum);
                        //     item.keyPopulationNum && (keyPopulationNumTotal += item.keyPopulationNum);
                        //     item.keyPopulationContractNum && (keyPopulationContractNumTotal += item.keyPopulationContractNum);
                        //     item.keyPopulationContractRate && (keyPopulationContractRateTotal += item.keyPopulationContractRate);
                        //     item.healthyPopulationNum && (healthyPopulationNumTotal += item.healthyPopulationNum);
                        //     item.healthyPopulationContractNum && (healthyPopulationContractNumTotal += item.healthyPopulationContractNum);
                        //     item.healthyPopulationContractRate && (healthyPopulationContractRateTotal += item.healthyPopulationContractRate);
                        //     item.subsistenceAllowanceNum && (subsistenceAllowanceNumTotal += item.subsistenceAllowanceNum);
                        //     item.subsistenceAllowanceContractNum && (subsistenceAllowanceContractNumTotal += item.subsistenceAllowanceContractNum);
                        //     item.subsistenceAllowanceContractRate && (subsistenceAllowanceContractRateTotal += item.subsistenceAllowanceContractRate);
                        //     item.difficultCrowdNum && (difficultCrowdNumTotal += item.difficultCrowdNum);
                        //     item.difficultCrowdContractNum && (difficultCrowdContractNumTotal += item.difficultCrowdContractNum);
                        //     item.difficultCrowdContractRate && (difficultCrowdContractRateTotal += item.difficultCrowdContractRate);
                        //     item.otherGroupsNum && (otherGroupsNumTotal += item.otherGroupsNum);
                        //     item.otherGroupsContractNum && (otherGroupsContractNumTotal += item.otherGroupsContractNum);
                        //     item.otherGroupsContractRate && (otherGroupsContractRateTotal += item.otherGroupsContractRate);
                        // }) 
                        // this.dataList.push({
                        //     orgName: '合计',
                        //     doctorNum: doctorNumTotal,
                        //     generalNum: generalNumTotal,
                        //     practitionerNum: practitionerNumTotal,
                        //     teamNum: teamNumTotal,
                        //     permanentResidentNum: permanentResidentNumTotal,
                        //     permanentResidentContractNum: permanentResidentContractNumTotal,
                        //     permanentResidentExtendNum: permanentResidentExtendNumTotal,
                        //     permanentResidentContractRate: permanentResidentContractRateTotal,
                        //     childrenNum: childrenNumTotal,
                        //     childrenContractNum: childrenContractNummTotal,
                        //     childrenExtendNum: childrenExtendNumTotal,
                        //     elderlyNum: elderlyNumTotal,
                        //     elderlyContractNum: elderlyContractNumTotal,
                        //     elderlyExtendNum: elderlyExtendNumTotal,
                        //     puerperaNum: puerperaNumTotal,
                        //     puerperaContractNum: puerperaContractNumTotal,
                        //     hypertensivePatientsNum: hypertensivePatientsNumTotal,
                        //     hypertensivePatientsContractNum: hypertensivePatientsContractNumTotal,
                        //     diabeticNum: diabeticNumTotal,
                        //     diabeticContractNum: diabeticContractNumTotal,
                        //     diabeticExtendNum: diabeticExtendNumTotal,
                        //     tuberculosisPatientsNum: tuberculosisPatientsNumTotal,
                        //     tuberculosisPatientsContractNum: tuberculosisPatientsContractNumTotal,
                        //     mentalDisorderNum: mentalDisorderNumTotal,
                        //     mentalDisorderContractNum: mentalDisorderContractNumTotal,
                        //     mentalDisorderExtendNum: mentalDisorderExtendNumTotal,
                        //     disabledNum: disabledNumTotal,
                        //     disabledContractNum: disabledContractNumTotal,
                        //     disabledExtendNum: disabledExtendNumTotal,
                        //     spouseNum: spouseNumTotal,
                        //     spouseContractNum: spouseContractNumTotal,
                        //     spouseExtendNum: spouseExtendNumTotal,
                        //     noPoorNum: noPoorNumTotal,
                        //     noPoorContractNum: noPoorContractNumTotal,
                        //     noPoorExtendNum: noPoorExtendNumTotal,
                        //     returnPoorNum: returnPoorNumTotal,
                        //     returnPoorContractNum: returnPoorContractNumTotal,
                        //     keyPopulationNum: keyPopulationNumTotal,
                        //     keyPopulationContractNum: keyPopulationContractNumTotal,
                        //     keyPopulationContractRate: keyPopulationContractRateTotal,
                        //     healthyPopulationNum: healthyPopulationNumTotal,
                        //     healthyPopulationContractNum: healthyPopulationContractNumTotal,
                        //     healthyPopulationContractRate: healthyPopulationContractRateTotal,
                        //     subsistenceAllowanceNum: subsistenceAllowanceNumTotal,
                        //     subsistenceAllowanceContractNum: subsistenceAllowanceContractNumTotal,
                        //     subsistenceAllowanceContractRate: subsistenceAllowanceContractRateTotal,
                        //     difficultCrowdNum: difficultCrowdNumTotal,
                        //     difficultCrowdContractNum: difficultCrowdContractNumTotal,
                        //     difficultCrowdContractRate: difficultCrowdContractRateTotal,
                        //     otherGroupsNum: otherGroupsNumTotal,
                        //     otherGroupsContractNum: otherGroupsContractNumTotal,
                        //     otherGroupsContractRate: otherGroupsContractRateTotal,
                        // })
                    // } 
                } 
            })
            .catch(err => {
                console.log(err);
            });
        },
        //清除
        reset() {
            this.statisticalYear = ''
            this.statisticalMonth = ''
            this.loadPage(1);
        },
        // 下载导出信息
        fileDownload () {
            console.log('筛选过的列表',this.columns)
            let url = api.contractReportExport
            let params = {
                statisticalYear: this.statisticalYear,
                statisticalMonth: this.statisticalMonth ? this.statisticalMonth : 12,
                filterList: this.columns
            }           
            const link = document.createElement('a')
            this.$axios.post(url, params, { responseType: "arraybuffer" }).then(res =>{
                if (res.data) {
                    let ret = res.data;
                    // var blob = new Blob([ret],{ type:"application/vnd.ms-excel" });
                    // let objUrl = URL.createObjectURL(blob);
                    // window.location.href = objUrl;
                    let blob = new Blob([ret], {type: "application/vnd.ms-excel"})
                    let objectUrl = URL.createObjectURL(blob) // 创建URL
                    link.href = objectUrl
                    link.download = '家庭医生签约服务进展情况报表' // 自定义文件名
                    link.click() // 下载文件
                    URL.revokeObjectURL(objectUrl); // 释放内存
                }
            })
        },
    },
    watch: {
        checkAllGroup() {
            if(this.checkAllGroup == [
                '健康人', '高血压', '糖尿病', '65岁以上老年人', '孕产妇', '肺结核', '严重精神障碍患者', '残疾人', '低保、五保户', '计生特殊困难家庭', '脱贫户', '边缘易致贫户', '突发严重困难户', '其他人群', 
            ]) {
               
                this.columns = this.columns.filter(
                    // console.log('222222',col),
                    // console.log('444444',col.key),
                    col => col.key !== 'childrenNum' &&  col.key !== 'childrenContractNum' &&  col.key !== 'childrenExtendNum');
                    console.log(this.columns)
                    console.log(this.checkAllGroup)
            }
        },
    },
};
</script>
<style lang="less" scoped>
.signeList {
    padding: 10px;
    width: 100%;
    background: #ffffff;
    box-sizing: border-box;
    min-height: 600px;
    .w-select {
        width: 150px;
    }
    .m-table {
        margin: 10px 0;
        // border: 1px solid #dddee1;
        // font-size: 12px;
        // color: #495060;
        // text-align: center;
        // width: 100%;
        // overflow: scroll;
        .title {           
            // display: flex; 
            // justify-content: center;           //水平居中
            // align-items: center;            //垂直居中
            height: 40px;
            th,td {          
                width: 200px;
                text-overflow: ellipsis;
                vertical-align: middle;
                text-align: center;
                border-bottom: 1px solid #e9eaec;
                padding: 0 10px;
                font-size: 12px;
                color: #495060;
            }
            th {
                background-color: #f8f8f9;
            }
        }
        .title :first-child {
            width: 80px;
        }
        .hang:hover{
            background: #ebf7fc;
        }
    }
    .margin-up-down {
        display: inline-block;
        margin: 10px 0;
    }
    .btn {
        width: 50px;
        height: 32px;
        line-height: 18px;
    }
    .page {
        width: 100%;
        margin: 10px auto;
        text-align: center;
    }
}
.one {
    width: 150px;
}
.two {
    width: 200px;
}
.three {
    width: 250px;
}
.four {
    width: 80px;
}
.tableFooter {
    display: flex;
    // text-align: center;
    &>div {
        border-right: 1px solid #e9eaec;
        padding: 0 18px;
        &:last-child {
            border: none;
        }
    }
}
</style>